<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>个人信息</title>
	<meta name="renderer" content="webkit">	
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">	
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">	
	<meta name="apple-mobile-web-app-status-bar-style" content="black">	
	<meta name="apple-mobile-web-app-capable" content="yes">	
	<meta name="format-detection" content="telephone=no">	
	<link rel="stylesheet" type="text/css" href="common/layui/css/layui.css" media="all">
	<link rel="stylesheet" type="text/css" href="common/bootstrap/css/bootstrap.css" media="all">
	<link rel="stylesheet" type="text/css" href="common/global.css" media="all">
	<link rel="stylesheet" type="text/css" href="css/personal.css" media="all">
</head>
<body>
<section class="layui-larry-box">
	<div class="larry-personal">
		<header class="larry-personal-tit">
			<span>修改密码</span>
		</header><!-- /header -->
		<div class="larry-personal-body clearfix changepwd">
			<form class="layui-form col-lg-4" method="post" action="" id="xgpwd">
			 	<div class="layui-form-item">
					<label class="layui-form-label">用户名</label>
					<div class="layui-input-block">  
					  	<input type="text" name="account" id="lastname" autocomplete="off"  class="layui-input layui-disabled" value="" disabled="disabled" >
						<input type="text" name="account" id="lastname1" autocomplete="off"  class="layui-input layui-disabled" value="" hidden="hidden" >
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">新密码</label>
					<div class="layui-input-block">  
					  	<input type="password" name="password" id="newpw1" autocomplete="off"  class="layui-input" value="" placeholder="请输入新密码">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">确认密码</label>
					<div class="layui-input-block">  
					  	<input type="password" name="title"  id="newpw2" autocomplete="off"  class="layui-input" value="" placeholder="请输入确认新密码">
					</div>
				</div>
				<div class="layui-form-item change-submit">
					<div class="layui-input-block">
						<button class="layui-btn" id="tj" type="button" lay-filter="demo1" onclick="tochangepwd()">立即提交</button>
						<button type="reset" class="layui-btn layui-btn-primary">重置</button>
					</div>
				</div>
			</form>
		</div>
	</div>
</section>
<script src="jsplug/jquery-1.8.3.min.js"></script>
<script src="jsplug/jparticle.jquery.js"></script>
<script src="common/layui/lay/dest/layui.all.js"></script>
<script src="common/layui/layui.js"></script>
<script type="text/javascript" src="js/token.js"></script>
<script type="text/javascript">
	/*layui.use(['form','upload'],function(){
         var form = layui.form();
	});*/
	 //修改密码功能
	//从浏览器中获取当前登录的账户信息
	var lastname = sessionStorage.getItem("account");
	document.getElementById("lastname").value=lastname;
	document.getElementById("lastname1").value=lastname;
		function tochangepwd(){
		//先验证新密码的两个表中的内容是否一样
		var newpwd1=document.getElementById("newpw1").value;
		var newpwd2=document.getElementById("newpw2").value;
		if (newpwd1==newpwd2){
		//触发往后端发送请求
		tochangepwd_back();
		}else {
			layer.open({
				title: '警告'
				,content: '两次密码不一致'
			});
		}
		}
	//像后端发送修改密码的请求
	function tochangepwd_back(){
		$.post("/login/updatepassword",$("#xgpwd").serialize(),function (res){
			layer.open({
				title: '成功'
				,content: res.msg
			});
		},"json")
	}



</script>
</body>
</html>